from rest_framework.serializers import ModelSerializer, SerializerMethodField, DateTimeField
from .models import *


class ParkSer(ModelSerializer):
    class Meta:
        model = ParkModel
        fields = '__all__'


class UserSer(ModelSerializer):
    class Meta:
        model = UserModel
        fields = '__all__'


class RecordSer(ModelSerializer):
    start = DateTimeField('%Y-%m-%d %H:%M:%S')
    end = DateTimeField('%Y-%m-%d %H:%M:%S')
    user = UserSer()

    class Meta:
        model = RecordModel
        fields = '__all__'
